<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>yadis.services</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="yadis-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://www.openidenabled.com/yadis/">Python-Yadis</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="yadis-module.html">Package&nbsp;yadis</a> ::
        Module&nbsp;services
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="yadis.services-pysrc.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<h1 class="epydoc">Source Code for <a href="yadis.services-module.html">Module yadis.services</a></h1>
<pre class="py-src">
<tt class="py-lineno"> 1</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-0" class="py-name" targets="Package yadis=yadis-module.html"><a title="yadis" class="py-name" href="#" onclick="return doclink('link-0', 'yadis', 'link-0');">yadis</a></tt></tt><tt class="py-op">.</tt><tt id="link-1" class="py-name" targets="Module yadis.filters=yadis.filters-module.html"><a title="yadis.filters" class="py-name" href="#" onclick="return doclink('link-1', 'filters', 'link-1');">filters</a></tt></tt> <tt class="py-keyword">import</tt> <tt id="link-2" class="py-name" targets="Function yadis.filters.mkFilter()=yadis.filters-module.html#mkFilter"><a title="yadis.filters.mkFilter" class="py-name" href="#" onclick="return doclink('link-2', 'mkFilter', 'link-2');">mkFilter</a></tt></tt> </tt>
<tt class="py-lineno"> 2</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-3" class="py-name"><a title="yadis" class="py-name" href="#" onclick="return doclink('link-3', 'yadis', 'link-0');">yadis</a></tt></tt><tt class="py-op">.</tt><tt id="link-4" class="py-name" targets="Module yadis.discover=yadis.discover-module.html,Function yadis.discover.discover()=yadis.discover-module.html#discover"><a title="yadis.discover
yadis.discover.discover" class="py-name" href="#" onclick="return doclink('link-4', 'discover', 'link-4');">discover</a></tt></tt> <tt class="py-keyword">import</tt> <tt id="link-5" class="py-name"><a title="yadis.discover
yadis.discover.discover" class="py-name" href="#" onclick="return doclink('link-5', 'discover', 'link-4');">discover</a></tt></tt> </tt>
<tt class="py-lineno"> 3</tt>  <tt class="py-line"><tt class="py-keyword">from</tt> <tt id="link-6" class="py-name"><a title="yadis" class="py-name" href="#" onclick="return doclink('link-6', 'yadis', 'link-0');">yadis</a></tt></tt><tt class="py-op">.</tt><tt id="link-7" class="py-name" targets="Module yadis.etxrd=yadis.etxrd-module.html"><a title="yadis.etxrd" class="py-name" href="#" onclick="return doclink('link-7', 'etxrd', 'link-7');">etxrd</a></tt></tt> <tt class="py-keyword">import</tt> <tt id="link-8" class="py-name" targets="Function yadis.etxrd.parseXRDS()=yadis.etxrd-module.html#parseXRDS"><a title="yadis.etxrd.parseXRDS" class="py-name" href="#" onclick="return doclink('link-8', 'parseXRDS', 'link-8');">parseXRDS</a></tt></tt><tt class="py-op">,</tt> <tt id="link-9" class="py-name" targets="Function yadis.etxrd.iterServices()=yadis.etxrd-module.html#iterServices"><a title="yadis.etxrd.iterServices" class="py-name" href="#" onclick="return doclink('link-9', 'iterServices', 'link-9');">iterServices</a></tt></tt> </tt>
<tt class="py-lineno"> 4</tt>  <tt class="py-line"> </tt>
<a name="getServiceEndpoints"></a><div id="getServiceEndpoints-def"><tt class="py-lineno"> 5</tt> <a class="py-toggle" href="#" id="getServiceEndpoints-toggle" onclick="return toggle('getServiceEndpoints');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="yadis.services-module.html#getServiceEndpoints">getServiceEndpoints</a><tt class="py-op">(</tt><tt class="py-param">input_url</tt><tt class="py-op">,</tt> <tt class="py-param">flt</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="getServiceEndpoints-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="getServiceEndpoints-expanded"><tt class="py-lineno"> 6</tt>  <tt class="py-line">    <tt class="py-docstring">"""Perform the Yadis protocol on the input URL and return an</tt> </tt>
<tt class="py-lineno"> 7</tt>  <tt class="py-line"><tt class="py-docstring">    iterable of resulting endpoint objects.</tt> </tt>
<tt class="py-lineno"> 8</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<tt class="py-lineno"> 9</tt>  <tt class="py-line"><tt class="py-docstring">    @param flt: A filter object or something that is convertable to</tt> </tt>
<tt class="py-lineno">10</tt>  <tt class="py-line"><tt class="py-docstring">        a filter object (using mkFilter) that will be used to generate</tt> </tt>
<tt class="py-lineno">11</tt>  <tt class="py-line"><tt class="py-docstring">        endpoint objects. This defaults to generating BasicEndpoint</tt> </tt>
<tt class="py-lineno">12</tt>  <tt class="py-line"><tt class="py-docstring">        objects.</tt> </tt>
<tt class="py-lineno">13</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<tt class="py-lineno">14</tt>  <tt class="py-line"><tt class="py-docstring">    @param input_url: The URL on which to perform the Yadis protocol</tt> </tt>
<tt class="py-lineno">15</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<tt class="py-lineno">16</tt>  <tt class="py-line"><tt class="py-docstring">    @return: The normalized identity URL and an iterable of endpoint</tt> </tt>
<tt class="py-lineno">17</tt>  <tt class="py-line"><tt class="py-docstring">        objects generated by the filter function.</tt> </tt>
<tt class="py-lineno">18</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<tt class="py-lineno">19</tt>  <tt class="py-line"><tt class="py-docstring">    @rtype: (str, [endpoint])</tt> </tt>
<tt class="py-lineno">20</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<tt class="py-lineno">21</tt>  <tt class="py-line">    <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt id="link-10" class="py-name"><a title="yadis.discover
yadis.discover.discover" class="py-name" href="#" onclick="return doclink('link-10', 'discover', 'link-4');">discover</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">input_url</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">22</tt>  <tt class="py-line">    <tt class="py-name">endpoints</tt> <tt class="py-op">=</tt> <tt id="link-11" class="py-name" targets="Function yadis.services.applyFilter()=yadis.services-module.html#applyFilter"><a title="yadis.services.applyFilter" class="py-name" href="#" onclick="return doclink('link-11', 'applyFilter', 'link-11');">applyFilter</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">result</tt><tt class="py-op">.</tt><tt id="link-12" class="py-name" targets="Variable yadis.discover.DiscoveryResult.normalized_uri=yadis.discover.DiscoveryResult-class.html#normalized_uri"><a title="yadis.discover.DiscoveryResult.normalized_uri" class="py-name" href="#" onclick="return doclink('link-12', 'normalized_uri', 'link-12');">normalized_uri</a></tt></tt><tt class="py-op">,</tt> <tt class="py-name">result</tt><tt class="py-op">.</tt><tt id="link-13" class="py-name" targets="Variable yadis.discover.DiscoveryResult.response_text=yadis.discover.DiscoveryResult-class.html#response_text"><a title="yadis.discover.DiscoveryResult.response_text" class="py-name" href="#" onclick="return doclink('link-13', 'response_text', 'link-13');">response_text</a></tt></tt><tt class="py-op">,</tt> <tt class="py-name">flt</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">23</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-op">(</tt><tt class="py-name">result</tt><tt class="py-op">.</tt><tt id="link-14" class="py-name"><a title="yadis.discover.DiscoveryResult.normalized_uri" class="py-name" href="#" onclick="return doclink('link-14', 'normalized_uri', 'link-12');">normalized_uri</a></tt></tt><tt class="py-op">,</tt> <tt class="py-name">endpoints</tt><tt class="py-op">)</tt> </tt>
</div><tt class="py-lineno">24</tt>  <tt class="py-line"> </tt>
<a name="applyFilter"></a><div id="applyFilter-def"><tt class="py-lineno">25</tt> <a class="py-toggle" href="#" id="applyFilter-toggle" onclick="return toggle('applyFilter');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="yadis.services-module.html#applyFilter">applyFilter</a><tt class="py-op">(</tt><tt class="py-param">normalized_uri</tt><tt class="py-op">,</tt> <tt class="py-param">xrd_data</tt><tt class="py-op">,</tt> <tt class="py-param">flt</tt><tt class="py-op">=</tt><tt class="py-name">None</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
</div><div id="applyFilter-collapsed" style="display:none;" pad="++" indent="++++"></div><div id="applyFilter-expanded"><tt class="py-lineno">26</tt>  <tt class="py-line">    <tt class="py-docstring">"""Generate an iterable of endpoint objects given this input data,</tt> </tt>
<tt class="py-lineno">27</tt>  <tt class="py-line"><tt class="py-docstring">    presumably from the result of performing the Yadis protocol.</tt> </tt>
<tt class="py-lineno">28</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<tt class="py-lineno">29</tt>  <tt class="py-line"><tt class="py-docstring">    @param normalized_uri: The input URL, after following redirects,</tt> </tt>
<tt class="py-lineno">30</tt>  <tt class="py-line"><tt class="py-docstring">        as in the Yadis protocol.</tt> </tt>
<tt class="py-lineno">31</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<tt class="py-lineno">32</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<tt class="py-lineno">33</tt>  <tt class="py-line"><tt class="py-docstring">    @param xrd_data: The XML text the XRDS file fetched from the</tt> </tt>
<tt class="py-lineno">34</tt>  <tt class="py-line"><tt class="py-docstring">        normalized URI.</tt> </tt>
<tt class="py-lineno">35</tt>  <tt class="py-line"><tt class="py-docstring">    @type xrd_data: str</tt> </tt>
<tt class="py-lineno">36</tt>  <tt class="py-line"><tt class="py-docstring"></tt> </tt>
<tt class="py-lineno">37</tt>  <tt class="py-line"><tt class="py-docstring">    """</tt> </tt>
<tt class="py-lineno">38</tt>  <tt class="py-line">    <tt class="py-name">flt</tt> <tt class="py-op">=</tt> <tt id="link-15" class="py-name"><a title="yadis.filters.mkFilter" class="py-name" href="#" onclick="return doclink('link-15', 'mkFilter', 'link-2');">mkFilter</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">flt</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">39</tt>  <tt class="py-line">    <tt class="py-name">et</tt> <tt class="py-op">=</tt> <tt id="link-16" class="py-name"><a title="yadis.etxrd.parseXRDS" class="py-name" href="#" onclick="return doclink('link-16', 'parseXRDS', 'link-8');">parseXRDS</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">xrd_data</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">40</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno">41</tt>  <tt class="py-line">    <tt class="py-name">endpoints</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
<tt class="py-lineno">42</tt>  <tt class="py-line">    <tt class="py-keyword">for</tt> <tt class="py-name">service_element</tt> <tt class="py-keyword">in</tt> <tt id="link-17" class="py-name"><a title="yadis.etxrd.iterServices" class="py-name" href="#" onclick="return doclink('link-17', 'iterServices', 'link-9');">iterServices</a></tt></tt><tt class="py-op">(</tt><tt class="py-name">et</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
<tt class="py-lineno">43</tt>  <tt class="py-line">        <tt class="py-name">endpoints</tt><tt class="py-op">.</tt><tt class="py-name">extend</tt><tt class="py-op">(</tt> </tt>
<tt class="py-lineno">44</tt>  <tt class="py-line">            <tt class="py-name">flt</tt><tt class="py-op">.</tt><tt id="link-18" class="py-name" targets="Method yadis.filters.CompoundFilter.getServiceEndpoints()=yadis.filters.CompoundFilter-class.html#getServiceEndpoints,Method yadis.filters.IFilter.getServiceEndpoints()=yadis.filters.IFilter-class.html#getServiceEndpoints,Method yadis.filters.TransformFilterMaker.getServiceEndpoints()=yadis.filters.TransformFilterMaker-class.html#getServiceEndpoints,Function yadis.services.getServiceEndpoints()=yadis.services-module.html#getServiceEndpoints"><a title="yadis.filters.CompoundFilter.getServiceEndpoints
yadis.filters.IFilter.getServiceEndpoints
yadis.filters.TransformFilterMaker.getServiceEndpoints
yadis.services.getServiceEndpoints" class="py-name" href="#" onclick="return doclink('link-18', 'getServiceEndpoints', 'link-18');">getServiceEndpoints</a></tt></tt><tt class="py-op">(</tt><tt id="link-19" class="py-name"><a title="yadis.discover.DiscoveryResult.normalized_uri" class="py-name" href="#" onclick="return doclink('link-19', 'normalized_uri', 'link-12');">normalized_uri</a></tt></tt><tt class="py-op">,</tt> <tt class="py-name">service_element</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
<tt class="py-lineno">45</tt>  <tt class="py-line"> </tt>
<tt class="py-lineno">46</tt>  <tt class="py-line">    <tt class="py-keyword">return</tt> <tt class="py-name">endpoints</tt> </tt>
</div><tt class="py-lineno">47</tt>  <tt class="py-line"> </tt><script type="text/javascript">
<!--
expandto(location.href);
// -->
</script>
</pre>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="yadis-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://www.openidenabled.com/yadis/">Python-Yadis</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">Generated by Epydoc
        3.0alpha3 on Fri Dec  8 13:17:19 2006</td>
    <td align="right" class="footer">
      <a href="http://epydoc.sourceforge.net">http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie()
  // -->
</script>
  
</body>
</html>
